import Mock from 'mockjs2'
import { builder } from '../util'

const booklist = () => {
  console.log('**************收到请求***************')

  var listData = []
  for (var idx = 0; idx < 10; idx++) {
    listData.push({
      img: '/imges/book_img/default.jpg',
      name: '书名' + idx,
      authors: '作者',
      publisher: '出版社',
      sub_name: '副标题',
      translators: '翻译者',
      publish_date: '出版年',
      pages: '页数',
      binding: '封装',
      series: '丛书',
      isbn: 'ISBN',
      douban_score: '5'
    })
  }
  console.log('**************listData***************')
  console.log(listData)
  return builder({
    listData,
    tags: ['全部', '小说', '外国文学', '中国文学', '散文', '鲁迅', '经典', '流行', '文化', '生活', '经管', '科技'],
    pagination: {
      // onChange: page => {
      //   console.log(page)
      // },
      pageSize: 3
    }
  })
}
// Mock.mock(/\/book\/findallbooks/, 'get', booklist)
Mock.mock(/\/api\/book\/findallbooks/, 'post', booklist)
